 <%@ include file="../common.jsp" %>
 
<script type="text/javascript">
$(document).ready(function() {
	
	var icons = {
			header: "ui-icon-plusthick",
			headerSelected: "ui-icon-minusthick"
			};

	//$( "#adminMenu" ).accordion( "option", "icons", icons );
 	//createLayoutForAdmin();
 	$( "#adminMenu" ).accordion({
		icons: icons
	});
	appInnerLayout = $('#contentDiv').layout({
		 west__size: 				300
		,west__closable: 			true
		,west__resizable:			false
		,west__spacing_open:		5
		,west__spacing_closed:		20
		,west__paneSelector: 		'#menuDiv'
		,togglerLength_open:		36
 		,togglerLength_closed:		140
 		,togglerAlign_closed:		"top"
		,center__paneSelector: 		subContentDiv
 		,togglerContent_closed:		"C<BR>O<BR>N<BR>T<BR>E<BR>N<BR>T<BR>S"
	});
	appMainLayout.resizeAll();
	//appInnerLayout.resizeAll();
	
	//enable admin functions
	var flagAdd = '<c:out value="${enableAddAdminModule}"></c:out>';
	var flagView = '<c:out value="${enableViewAdminModule}"></c:out>';
	var flagEdit = '<c:out value="${enableEditAdminModule}"></c:out>';
	var flagDelete = '<c:out value="${enableDeleteAdminmodule}"></c:out>';
	if(flagAdd == 1){
		$("a.classAdd").each(function(){
			$(this).css("display","block");
		});
	}
	if(flagView == 1){
		$("a.classView").each(function(){
			$(this).css("display","block");
		});
	}
	if(flagEdit == 1){
		$("a.classEdit").each(function(){
			$(this).css("display","block");
		});
	}
	if(flagDelete == 1){
		$("a.classDelete").each(function(){
			$(this).css("display","block");
		});
	}
});
</script>
<style>
	.classAdd {
		display: none;
	}
	.classView {
		display: none;
	}
	.classEdit {
		display: none;
	}
</style>

<c:choose>
	<c:when test="${fn:length(armoryMasterData) > 0}">
		<div id="menuDiv">
		<c:out value=""></c:out>
			<div id="adminMenu" class="ui-layout-pane-west">
					<sec:authorize access="hasAnyRole('ROLE_SU')">
					<h2 class="ui-accordion-header"> <a href="#">Company</a></h2>
						<div class="ui-accordion-content">
							<a href="javascript:getAddCompanyWin()" class="classAdd">Add</a>
<!-- 							<a href="javascript:getSelectCompanyType()">Add</a><br> -->
							<a href="javascript:ViewCompany()" class="classView">View</a>
							<a href="javascript:editCompany()" class="classEdit">Edit</a>
							<!-- <a href="javascript:deleteCompany()">Delete</a> -->
						</div>
					</sec:authorize>
					<sec:authorize access="hasAnyRole('ROLE_SU','ROLE_DMSADMIN')">
					<h2 class="ui-accordion-header"><a href="#">Business UnitType</a></h2>
						<div class="ui-accordion-content">
							<a href="javascript:getAddBusinessUnitTypeWin()" class="classAdd">Add</a>
							<a href="javascript:viewBusinessUnitType()" class="classView">View</a>
							<a href="javascript:editBusinessUnitType()" class="classEdit">Edit</a>
						</div>
					<h2 class="ui-accordion-header"><a href="#">Department</a></h2>
						<div class="ui-accordion-content">	
							<a href="javascript:getAddDepartmentWin()" class="classAdd">Add</a>
							<a href="javascript:viewDepartment()" class="classView">View</a>
							<a href="javascript:editDepartment()" class="classEdit">Edit</a>
						</div>	
					<h2 class="ui-accordion-header"><a href="#">Business Unit</a></h2>
						<div class="ui-accordion-content">
							<a href="javascript:getAddLocationWin()" class="classAdd">Add</a>
						    <a href="javascript:viewLocation()" class="classView">View</a>
						    <a href="javascript:editLocation()" class="classEdit">Edit</a>
						</div>
					
					<h2 class="ui-accordion-header"><a href="#">User</a></h2>
						<div class="ui-accordion-content">	
							<a href="javascript:getAddUserWin()" class="classAdd">Add</a>
							<a href="javascript:viewUser()" class="classView">View</a>
							<a href="javascript:editUser()" class="classEdit">Edit</a>
						</div>
					
					<h2 class="ui-accordion-header"><a href="#">Document Type</a></h2>
						<div class="ui-accordion-content">
							<a href="javascript:getAddDocTypeWin()" class="classAdd">Add</a>
							<a href="javascript:viewDocType()" class="classView">View</a>
							<a href="javascript:editDocType()" class="classEdit">Edit</a>
						</div>
						
					<h2 class="ui-accordion-header"><a href="#">Document Category</a></h2>
						<div class="ui-accordion-content">
							<a href="javascript:getAddDocCategoryWin()" class="classAdd">Add</a>
							<a href="javascript:viewDocCategory()" class="classView">View</a>
							<a href="javascript:editDocCategory()" class="classEdit">Edit</a>
						</div>
					<h2 class="ui-accordion-header"><a href="#">Document Sub Category</a></h2>
						<div class="ui-accordion-content">
							<a href="javascript:getAddDocSubCategoryWin()" class="classAdd">Add</a>
							<a href="javascript:viewDocSubCategory()" class="classView">View</a>
							<a href="javascript:editDocSubCategory()" class="classEdit">Edit</a>
						</div>
					</sec:authorize>
					<sec:authorize access="hasAnyRole('ROLE_DMSADMIN','ROLE_SU','ROLE_CCC','ROLE_CC')">
					<h2 class="ui-accordion-header"><a href="#">User Role Mapping</a></h2>
						<div class="ui-accordion-content">
							<a href="javascript:searchUserPage()">User Role</a><br>
							<a href="javascript:mapSuperficialRoles()" >Map Superficial Roles</a><br>
							<a href="javascript:workFlowRole()" >Work Flow Role</a>
						</div>	
					</sec:authorize>
					<sec:authorize access="hasAnyRole('ROLE_DMSADMIN','ROLE_SU')">
					<h2 class="ui-accordion-header"><a href="#">Masters</a></h2>
						<div class="ui-accordion-content">
							<a href="javascript:addNewLocationDetails()">Location Master</a>
						</div>			
					</sec:authorize>
				</div>	
		</div>
		
		<div id="subContentDiv">
		</div>

	</c:when>
	<c:otherwise>
		<form name="selectMasterDataForWF" id="selectMasterDataForWF">
			<div id="subContentDiv">
				<table class="viewDetails">
					<tr class="heading"><td colspan="2">Select Master Data</td></tr>
					<tr class="odd"><td>Type</td><td><input type="checkbox" name="dataForWF" id="statusOfTypeDataForWF" value="Type" /></td></tr>
					<tr class="odd"><td>Location</td><td><input type="checkbox" name="dataForWF" id="statusOfLocationDataForWF" value="Location" /></td></tr>
					<tr class="odd"><td>Department</td><td><input type="checkbox" name="dataForWF" id="statusOfDepartmentDataForWF" value="Department" /></td></tr>
					<tr class="odd"><td colspan="2"><input type="button" value="Submit" onclick="validate();"></td></tr>
				</table>
			</div>	
		</form>
	</c:otherwise>
</c:choose>



